package com.chixing.controller;

import com.chixing.service.MyorderService;
import com.chixing.service.OrderService;
import com.chixing.util.ServerResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
public class MyorderController {
    @Autowired
    private MyorderService myorderService;

    @GetMapping("car/car/{carModel}")
    @ResponseBody
    public ServerResponse car(@PathVariable("carModel") String carModel){
        ServerResponse serverResponse = myorderService.getByCar(carModel);
        return serverResponse;
    }

    @GetMapping("center/myorder")
    @ResponseBody
    public ServerResponse getByStatus (Integer custId,Integer status,Integer pageNum){
        if (pageNum==null)
            pageNum = 1;
        return myorderService.getByStatus(custId,status,pageNum);
    }


}
